<template>
  <a-modal okText="确定" cancelText="取消" @ok="ok"
           @cancel="close" v-model="visible" title="新建业务列表">
    <Row label="业务列表名称">
      <a-input v-model="menuName" placeholder="请输入业务列表名称"/>
    </Row>
  </a-modal>
</template>
<script>
import Row from '@/components/hhd/design/FormDesigner/base/Row.vue';
import {createFormMenu} from '@/components/hhd/design/FormDesigner/types';

export default {
  name: 'FormMenuModal',
  components: {Row},
  data() {
    return {
      visible: false,
      menuName: undefined
    };
  },
  methods: {
    open() {
      this.visible = true;
    },
    close() {
      this.visible = false;
      this.menuName = undefined;
    },
    ok() {
      if (!this.menuName) {
        this.$message.error('业务列表名称不能为空')
        return;
      }
      let menu = createFormMenu();
      menu.menuName = this.menuName;
      this.$emit('ok', menu);
      this.close();
    },
  }
};
</script>